package com.mervin.patterns.singleton.type7;

/***************************************
 * @Auther: mervin
 * @Date: 2020-04-15 23:56
 * @Description: 使用静态内部类
 ***************************************/
public class SingletonTest7 {
    public static void main(String[] args) {
        System.out.println(Singleton.getInstance());
        System.out.println(Singleton.getInstance());
    }
}

class Singleton{

    private Singleton(){}

    private static class SingletonInstance{
        private static final Singleton INSTANCE = new Singleton();
    }

    public static Singleton getInstance(){
        return SingletonInstance.INSTANCE;
    }
}
